/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.gov.cemaden.smp.controler;

import br.gov.cemaden.library.model.smp.ThreadAplic;
import java.io.Serializable;
import java.lang.management.ThreadMXBean;

/**
 *
 * @author Simone Santos
 */
public class ThreadAplicBean implements Serializable {

    ThreadAplic thr = new ThreadAplic();

    public ThreadAplicBean() {
    }

    public ThreadAplic get(ThreadMXBean remoteThreading) {
        thr.setLive(remoteThreading.getThreadCount());
        thr.setPeak(remoteThreading.getThreadCount());
        thr.setTotal(remoteThreading.getTotalStartedThreadCount());
        return thr;
    }

    public void show(ThreadAplic t) {

        String separator = "--------------------------------";

        System.out.printf("Threads%nLive: %d%nPeak: %d%nTotal: %d%n%s%n", t.getTotal(), t.getPeak(), t.getLive(), separator);
    }
}
